//js分包
var demo = {
		//这里存放所有的url
		url:{
			file:{
				upload:'/file/upload',
				download:'/file/download?fileName='
			}
		},
		//文件相关
		file :{
			//初始化方法
			init:function(){
				var uploader = WebUploader.create({
	                auto: false,
	                server: demo.url.file.upload,
	                pick:{
	                	id:"#temp",
	                	innerHTML:"上传文件",
	                	multiple:false
	                },
	                accept: {
	                    title: 'Images',
	                    extensions: 'gif,jpg,jpeg,bmp,png',
	                    mimeTypes: 'image/*'
	                }
	            });
				//上传成功
	            uploader.on('uploadSuccess', function (file, response) {
	            	var url = demo.url.file.download;
	                $('body').css('background','url('+url+response._raw+')')
	            });
	            
	            //主动控制上传
	            $("#temp").change(function(){
	            	uploader.upload();
	            });
			},	
		},
		index :{
			init :function(){
				var fiveSeconds =1485532800000;
				$('.countdown-container').countdown(fiveSeconds)
				        .on('update.countdown', function(event) {
				            var format = '%H:%M:%S';
				                if(event.offset.totalDays > 0) {
				                    format = '%-d day%!d ' + format;
				                }
				                if(event.offset.weeks > 0) {
				                    format = '%-w week%!w ' + format;
				                }
				                $(this).html(event.strftime(format));
				        })
				        .on('finish.countdown', function(event) {
				        	$(this).html("Design, collaborate, win!");
				        });
			}
		}
		
}